<template>
  <div>
      <el-button type="primary" size="small" @click="dialogFormVisible = true">添加分类</el-button>
       <el-dialog title="添加分类" :visible.sync="dialogFormVisible">
        <el-form :model="form">
          <el-form-item label="名称">
            <el-input v-model="form.type_name" autocomplete="off"></el-input>
          </el-form-item>
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click="dialogFormVisible = false">取 消</el-button>
          <el-button type="primary" @click="addGoods()">确 定</el-button>
        </div>
      </el-dialog>
  </div>
</template>

<script>
export default {
    data(){
        return{
            dialogFormVisible:false,
            form:{
                type_name:'',
            },
            formLabelWidth:30,
        }
    },
    methods:{
        addGoods(){
            this.$axios.post('insertType',this.form).then(resp=>{
                if(resp.status==200){
                    this.$message.success("添加成功")
                    this.dialogFormVisible = false
                }
            })
        },
    }
}
</script>

<style>

</style>